var e = require;
var t = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("sdkConfig"),
    a = (function () {
        function e() {
            (this.SW_SystemBanner = !1),
                (this.SW_SystemInters = !1),
                (this.SW_Video = !1),
                (this.SW_Native = !1),
                (this.SW_NativeBanner = !1),
                (this.SW_NativeInters = !1),
                (this.SW_Box = !1),
                (this.SW_Block = !1),
                (this.SW_BigNative = !1),
                (this.SW_IconNative = !1),
                (this.ID_SystemBanner = ""),
                (this.ID_SystemInters = ""),
                (this.ID_Native = ""),
                (this.ID_NativeCustom = ""),
                (this.ID_Video = ""),
                (this.ID_Box = ""),
                (this.ID_Block = ""),
                (this.NUM_NativeIntersP = 0),
                (this.NUM_NativeIntersReport = 1),
                (this.NUM_BannerErrP = 0),
                (this.NUM_BannerErrMost = 0),
                (this.NUM_BannerErrMust = 0),
                (this.NUM_VideoErrP = 0),
                (this.NUM_VideoErrMost = 0),
                (this.NUM_VideoErrMust = 0),
                (this.NUM_BannerUpdateTime = 30),
                (this.SW_SystemBannerFirst = !0),
                (this.NUM_BannerMostShow = 99),
                (this.SW_IntersBaseControl = !1),
                (this.NUM_IntersStart = 0),
                (this.NUM_IntersIntervalNum = 0),
                (this.NUM_IntersIntervalTime = 0),
                (this.NUM_IntersDelayTime = 0),
                (this.NUM_IntersDelayP = 0),
                (this.NUM_NativeUpdateTime = 30),
                (this.SW_AddDesktop = !1),
                (this.SW_IntersIntervalToAddDesktop = !1),
                (this.NUM_AutoAddDeskMostTimes = 0),
                (this.NUM_IntersToAddDesktopNumber = 0),
                (this.SW_Statistics = !0),
                (this.SW_NavigateIcon = !1),
                (this.SW_NavigateGroup = !1),
                (this.SW_NavigateSettle = !1),
                (this.pushGameList = []),
                (this.bannerAd = null),
                (this.loadSucc_SystemBanner = !1),
                (this.loadSucc_Banner = !1),
                (this.hasShowBanner = !1),
                (this.interval_updateBanner = null),
                (this.timeout_checkBannerLoadSucc = null),
                (this.NUM_CheckBannerLoadSucc = 0),
                (this.NUM_MaxCheckBannerLoadSucc = 5),
                (this.systemIntersAd = null),
                (this.loadSucc_SystemInters = !1),
                (this.NUM_hasShowInters = 0),
                (this.NUM_intersNowInterval = 0),
                (this.NUM_IntersNowIntervalTime = 99),
                (this.NUM_IntersNowToAddDesktop = 0),
                (this.videoAd = null),
                (this.loadSucc_Video = !1),
                (this.callback_Video = null),
                (this.isShow_Video = !1),
                (this.miniGame_version = "101"),
                (this.app_test_version = !1);
        }
        return (
            (e.prototype.GameVersion = function (e) {
                this.app_test_version = this.miniGame_version == e;
            }),
            (e.prototype.getGameTestVersion = function () {
                return this.app_test_version;
            }),
            (e.prototype.createAd = function () {
                this.SW_SystemBanner && this.createSystemBanner(),
                    this.SW_SystemInters && this.createSystemInters(),
                    this.NUM_IntersIntervalTime > 0 && this.runIntersInterval(),
                    this.SW_Video && this.createVideo(),
                    gamebox.setKeepScreenOn({keepScreenOn: !0});
            }),
            (e.prototype.startLoadPushGamaes = function () {}),
            (e.prototype.createSystemBanner = function () {
                var e = this;
                if (n.default.stringHasSpace(this.ID_SystemBanner))
                    console.log(
                        "ChaoQiGameSDK",
                        "channelId:",
                        n.default.channelId,
                        "当前渠道系统banner广告ID中含有空字符串,请检查后台系统banner广告ID*********************"
                    );
                else {
                    var t = gamebox.getSystemInfoSync().pixelRatio,
                        o = 320 * t,
                        a = 55 * t,
                        i = gamebox.getSystemInfoSync().windowWidth,
                        r = gamebox.getSystemInfoSync().windowHeight;
                    (this.bannerAd = gamebox.createBannerAd({
                        style: {width: o, height: a, left: (i * t - o) / 2, top: r * t - a}
                    })),
                        this.bannerAd.onLoad(function () {
                            console.log("XminigameSDK", "M4399box 系统banner广告加载成功"),
                                (e.loadSucc_SystemBanner = !0),
                                e.hasShowBanner && e.showSystemBanner();
                        }),
                        this.bannerAd.onError(function (e) {
                            console.log("XminigameSDK", "M4399box 系统banner广告加载失败", JSON.stringify(e));
                        });
                }
            }),
            (e.prototype.createSystemInters = function () {
                var e = this;
                n.default.stringHasSpace(this.ID_SystemInters)
                    ? console.log(
                          "ChaoQiGameSDK",
                          "channelId:",
                          n.default.channelId,
                          "当前渠道系统插屏广告ID中含有空字符串,*********************"
                      )
                    : ((this.systemIntersAd = gamebox.createInterstitialAd()),
                      this.systemIntersAd.onLoad(function (t) {
                          console.log("XminigameSDK", "M4399box 系统插屏广告加载成功", JSON.stringify(t)),
                              (e.loadSucc_SystemInters = !0);
                      }),
                      this.systemIntersAd.onError(function (e) {
                          console.log("XminigameSDK", "M4399box 插屏加载失败", JSON.stringify(e));
                      }),
                      this.systemIntersAd.onClose(function (t) {
                          console.log("XminigameSDK", "M4399box 关闭插屏", JSON.stringify(t)),
                              (e.NUM_IntersNowIntervalTime = 0);
                      }),
                      this.systemIntersAd.load());
            }),
            (e.prototype.createVideo = function () {
                var e = this;
                n.default.stringHasSpace(this.ID_Video)
                    ? console.log(
                          "ChaoQiGameSDK",
                          "channelId:",
                          n.default.channelId,
                          "当前渠道视频广告ID中含有空字符串,请检查后台视频广告ID*********************"
                      )
                    : ((this.videoAd = gamebox.createRewardedVideoAd()),
                      this.videoAd.onLoad(function (t) {
                          console.log("XminigameSDK", "M4399box 视频广告加载完成", JSON.stringify(t)),
                              (e.loadSucc_Video = !0);
                      }),
                      this.videoAd.onError(function (t) {
                          console.log("XminigameSDK", "M4399box 视频广告加载失败", JSON.stringify(t)),
                              (e.loadSucc_Video = !1),
                              setTimeout(function () {
                                  e.videoAd && e.videoAd.load();
                              }, 3e4);
                      }),
                      this.videoAd.onClose(function (t) {
                          console.log("XminigameSDK", "M4399box 视频广告关闭", JSON.stringify(t)),
                              t.isEnded
                                  ? (console.log("XminigameSDK", "M4399box 激励视频广告完成，发放奖励"),
                                    e.callback_Video &&
                                        (e.callback_Video(!0), (e.loadSucc_Video = !1), e.videoAd.load()))
                                  : (console.log("XminigameSDK", "M4399box 激励视频广告取消关闭，不发放奖励"),
                                    e.callback_Video &&
                                        (e.callback_Video(!1), (e.loadSucc_Video = !1), e.videoAd.load())),
                              (e.isShow_Video = !1);
                      }),
                      this.videoAd.load());
            }),
            (e.prototype.showBanner = function () {
                this.loadSucc_Banner
                    ? this.hasShowBanner
                        ? console.log("XminigameSDK", "已经调用过showBanner,请勿重复调用")
                        : ((this.hasShowBanner = !0),
                          this.SW_SystemBanner && (this.showSystemBanner(), this.updateSystemBanner()))
                    : this.checkBannerLoadSucc();
            }),
            (e.prototype.hideBanner = function () {
                (this.hasShowBanner = !1),
                    this.hideSystemBanner(),
                    this.interval_updateBanner && clearInterval(this.interval_updateBanner),
                    this.timeout_checkBannerLoadSucc && clearTimeout(this.timeout_checkBannerLoadSucc);
            }),
            (e.prototype.getIntersFlag = function () {
                return this.loadSucc_SystemInters;
            }),
            (e.prototype.showInters = function () {
                var e = this;
                if (
                    (this.NUM_hasShowInters++,
                    this.SW_IntersIntervalToAddDesktop &&
                        this.NUM_hasShowInters <= this.NUM_IntersToAddDesktopNumber &&
                        (console.log(
                            "XminigameSDK",
                            "第" + this.NUM_IntersToAddDesktopNumber + "次插屏变添加桌面",
                            "当前第" + this.NUM_hasShowInters + "次"
                        ),
                        this.NUM_hasShowInters == this.NUM_IntersToAddDesktopNumber))
                )
                    this.getAddDesktopFlag(function (t) {
                        t && (console.log("XminigameSDK", "插屏变添加桌面"), e.addDesktop(function () {}));
                    });
                else {
                    if (this.SW_IntersBaseControl) {
                        if (this.NUM_hasShowInters < this.NUM_IntersStart)
                            return void console.log(
                                "XminigameSDK",
                                "插屏开始次数未达到",
                                this.NUM_hasShowInters,
                                "目标次数",
                                this.NUM_IntersStart
                            );
                        if (this.NUM_intersNowInterval < this.NUM_IntersIntervalNum)
                            return (
                                console.log(
                                    "XminigameSDK",
                                    "插屏间隔次数未达到",
                                    this.NUM_intersNowInterval,
                                    "目标次数",
                                    this.NUM_IntersIntervalNum
                                ),
                                void this.NUM_intersNowInterval++
                            );
                        if (this.NUM_IntersNowIntervalTime < this.NUM_IntersIntervalTime)
                            return (
                                console.log(
                                    "XminigameSDK",
                                    "插屏间隔时间未达到",
                                    this.NUM_IntersNowIntervalTime,
                                    "目标时间",
                                    this.NUM_IntersIntervalTime
                                ),
                                void (
                                    this.SW_AddDesktop &&
                                    this.NUM_IntersNowToAddDesktop < this.NUM_AutoAddDeskMostTimes &&
                                    this.getAddDesktopFlag(function (t) {
                                        t &&
                                            (e.NUM_IntersNowToAddDesktop++,
                                            e.addDesktop(function () {
                                                console.log("XminigameSDK", "插屏间隔弹桌面");
                                            }));
                                    })
                                )
                            );
                    }
                    (this.NUM_intersNowInterval = 0),
                        this.NUM_IntersDelayTime > 0 && Math.floor(100 * Math.random()) < this.NUM_IntersDelayP
                            ? (console.log("XminigameSDK", "插屏延迟时间(ms):" + this.NUM_IntersDelayTime),
                              setTimeout(function () {
                                  e.loadSucc_SystemInters && e.showSystemInters();
                              }, this.NUM_IntersDelayTime))
                            : this.loadSucc_SystemInters && this.showSystemInters();
                }
            }),
            (e.prototype.getVideoFlag = function () {
                return this.loadSucc_Video;
            }),
            (e.prototype.showVideo = function (e) {
                var t = this;
                this.isShow_Video
                    ? console.log("XminigameSDK", "视频正在播放中,请勿多次点击！")
                    : ((this.isShow_Video = !0),
                      (this.callback_Video = e),
                      this.videoAd
                          ? this.videoAd
                                .show()
                                .then(function () {
                                    console.log("XminigameSDK", "激励视频广告显示成功");
                                })
                                .catch(function (e) {
                                    console.log("XminigameSDK", "激励视频广告组件出现问题", JSON.stringify(e)),
                                        t.videoAd.load().then(function () {
                                            console.log("XminigameSDK", "激励视频广告手动加载成功"),
                                                t.videoAd.show().catch(function (e) {
                                                    console.log(
                                                        "XminigameSDK",
                                                        "激励视频广告播放失败",
                                                        JSON.stringify(e)
                                                    ),
                                                        (t.isShow_Video = !1),
                                                        t.callback_Video(!1);
                                                });
                                        });
                                })
                          : ((this.isShow_Video = !1), this.callback_Video(!1)));
            }),
            (e.prototype.getNativeIconFlag = function () {
                return !1;
            }),
            (e.prototype.showNativeIcon = function () {}),
            (e.prototype.hideNativeIcon = function () {}),
            (e.prototype.getNativeImageFlag = function () {
                return !1;
            }),
            (e.prototype.showNativeImage = function () {}),
            (e.prototype.hideNativeImage = function () {}),
            (e.prototype.getNativeAdFlag = function () {
                return !1;
            }),
            (e.prototype.getNativeAdInfo = function () {
                return null;
            }),
            (e.prototype.reportNativeAdShow = function () {}),
            (e.prototype.reportNativeAdClick = function () {}),
            (e.prototype.getNavigateIconFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateIcon = function () {}),
            (e.prototype.hideNavigateIcon = function () {}),
            (e.prototype.getNavigateGroupFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateGroup = function () {}),
            (e.prototype.hideNavigateGroup = function () {}),
            (e.prototype.getNavigateSettleFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateSettle = function () {}),
            (e.prototype.hideNavigateSettle = function () {}),
            (e.prototype.getNavigateBoxBannerFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateBoxBanner = function () {}),
            (e.prototype.hideNavigateBoxBanner = function () {}),
            (e.prototype.getNavigateBoxPortalFlag = function () {
                return !1;
            }),
            (e.prototype.showNavigateBoxPortal = function () {}),
            (e.prototype.setGroup = function () {}),
            (e.prototype.hasAddDesktopFunc = function () {
                return !1;
            }),
            (e.prototype.getAddDesktopFlag = function (e) {
                e(!1);
            }),
            (e.prototype.addDesktop = function (e) {
                e(!1);
            }),
            (e.prototype.phoneVibrate = function (e) {
                "long" == e
                    ? gamebox.vibrateLong({
                          success: function () {},
                          fail: function (e) {
                              console.log("XminigameSDK", "M4399box vibrateLong fail", JSON.stringify(e));
                          }
                      })
                    : "short" == e &&
                      gamebox.vibrateShort({
                          success: function () {},
                          fail: function (e) {
                              console.log("XminigameSDK", "M4399box vibrateShort fail", JSON.stringify(e));
                          }
                      });
            }),
            (e.prototype.startGameVideo = function () {}),
            (e.prototype.pauseGameVideo = function () {}),
            (e.prototype.resumeGameVideo = function () {}),
            (e.prototype.stopGameVideo = function (e) {
                e(null);
            }),
            (e.prototype.shareVideo = function (e, t, o, n, a) {
                a(!1);
            }),
            (e.prototype.jumpToMoreGamesCenter = function () {}),
            (e.prototype.showMoreGamesBanner = function () {}),
            (e.prototype.hideMoreGamesBanner = function () {}),
            (e.prototype.showFavoriteGuide = function () {}),
            (e.prototype.getBoxFlag = function () {
                return !1;
            }),
            (e.prototype.showAppBox = function () {}),
            (e.prototype.getBlockFlag = function () {
                return !1;
            }),
            (e.prototype.showBlock = function () {}),
            (e.prototype.hideBlock = function () {}),
            (e.prototype.getVideoIntersFlag = function () {
                return !1;
            }),
            (e.prototype.showVideoInters = function () {}),
            (e.prototype.exitTheGame = function () {}),
            (e.prototype.reportAnalytics = function () {}),
            (e.prototype.showAuthentication = function (e) {
                e(!1);
            }),
            (e.prototype.visitorExperience = function (e) {
                e(!1);
            }),
            (e.prototype.showNativeAd = function () {}),
            (e.prototype.getOPPOShowMoreGameFlag = function () {
                return !1;
            }),
            (e.prototype.showOPPOMoreGame = function () {}),
            (e.prototype.hasNetwork = function (e) {
                e(!1);
            }),
            (e.prototype.showReviewAlert = function () {}),
            (e.prototype.showiOSADWithScene = function () {}),
            (e.prototype.showiOSADWithType = function () {}),
            (e.prototype.videoUIShow = function () {}),
            (e.prototype.showPrivacyAgreement = function (e, t, o) {
                o(!1);
            }),
            (e.prototype.getErrBannerFlag = function () {
                return !1;
            }),
            (e.prototype.showErrBanner = function (e) {
                e(!1);
            }),
            (e.prototype.hideErrBanner = function () {}),
            (e.prototype.getErrVideoFlag = function () {
                return !1;
            }),
            (e.prototype.buyProps = function (e, t, o, n) {
                n(!1, "");
            }),
            (e.prototype.payComplete = function () {}),
            (e.prototype.checkBannerLoadSucc = function () {
                var e = this;
                if (
                    ((this.loadSucc_Banner = this.SW_SystemBanner && this.loadSucc_SystemBanner),
                    console.log(
                        "XminigameSDK",
                        "banner加载成功?",
                        this.loadSucc_Banner,
                        ++this.NUM_CheckBannerLoadSucc
                    ),
                    this.timeout_checkBannerLoadSucc && clearTimeout(this.timeout_checkBannerLoadSucc),
                    this.loadSucc_Banner)
                )
                    this.showBanner();
                else {
                    if (this.NUM_CheckBannerLoadSucc >= this.NUM_MaxCheckBannerLoadSucc) return;
                    this.timeout_checkBannerLoadSucc = setTimeout(function () {
                        e.checkBannerLoadSucc();
                    }, 5e3);
                }
            }),
            (e.prototype.showSystemBanner = function () {
                this.bannerAd
                    ? (console.log("XminigameSDK", "M4399box showSystemBanner========================", this.bannerAd),
                      this.bannerAd.show())
                    : this.createSystemBanner();
            }),
            (e.prototype.updateSystemBanner = function () {
                var e = this;
                this.interval_updateBanner && clearInterval(this.interval_updateBanner),
                    (this.interval_updateBanner = setInterval(function () {
                        console.log("XminigameSDK", "M4399box updateSystemBanner========================"),
                            e.bannerAd.hide(),
                            e.bannerAd.destroy(),
                            (e.bannerAd = null),
                            e.createSystemBanner();
                    }, 1e3 * this.NUM_BannerUpdateTime));
            }),
            (e.prototype.hideSystemBanner = function () {
                this.bannerAd &&
                    (console.log("XminigameSDK", "M4399box hideSystemBanner========================"),
                    this.bannerAd.hide(),
                    this.bannerAd.destroy(),
                    (this.bannerAd = null)),
                    this.interval_updateBanner && clearInterval(this.interval_updateBanner);
            }),
            (e.prototype.showSystemInters = function () {
                this.systemIntersAd &&
                    this.loadSucc_SystemInters &&
                    (console.log("XminigameSDK", "M4399box showSystemInters========================"),
                    this.systemIntersAd.show());
            }),
            (e.prototype.runIntersInterval = function () {
                var e = this;
                this.NUM_IntersIntervalTime > 0 &&
                    setInterval(function () {
                        e.NUM_IntersNowIntervalTime++;
                    }, 1e3);
            }),
            e
        );
    })();
o.default = a;
